package com.cplsys.iacna.ui;

import java.net.URL;

import javax.annotation.PostConstruct;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cplsys.iacna.services.IIACNAWebService;
import com.cplsys.iacna.utils.IACNAConstants;
import com.cplsys.iacna.webservice.IACNAWebServicePubliser;

@Repository
public class IACNAMainFrame {

	private static final long serialVersionUID = 3879041067522897664L;
	@Autowired
	private IACNAUI iacnaUI;

	@PostConstruct
	public void init() {
		try {
			new IACNAWebServicePubliser();
			URL url = new URL(IACNAConstants.IACNA_WS_WSDL_ADDRESS);
			QName qname = new QName("http://webservice.iacna.cplsys.com/",
					"IACNAWebServiceImplService");
			Service service = Service.create(url, qname);
			IIACNAWebService hello = service.getPort(IIACNAWebService.class);
			hello.getMessageDemo("message");
		} catch (Exception e) {
			e.printStackTrace();
		}
		iacnaUI.setVisible(true);
	}

}